package com.dios.mirage.content;

import net.rim.device.api.system.Display;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.VerticalFieldManager;

import com.dios.mirage.component.Managers;
import com.dios.mirage.component.view.View;

public class HomeContent extends Content {

	private Managers a, b, c, d, e, f, g, h, i, j;
	VerticalFieldManager column;

	private int screenWidth;

	public void createGUI() {
		screenWidth = Display.getWidth();
		column = new VerticalFieldManager();
		init();
	}

	public void init() {
		ImageField[] as = new ImageField[] {
				new ImageField("img/home/1l-1.jpg", screenWidth,
						screenWidth / 2),
				new ImageField("img/home/2l-1.jpg", screenWidth,
						screenWidth / 2),
				new ImageField("img/home/3l-1.jpg", screenWidth,
						screenWidth / 2) };
		ImageField[] bs = new ImageField[] {
				new ImageField("img/home/1k-1.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/2k-1.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/3k-1.jpg", screenWidth / 2,
						screenWidth / 2) };
		ImageField[] cs = new ImageField[] {
				new ImageField("img/home/1k-2.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/2k-2.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/3k-2.jpg", screenWidth / 2,
						screenWidth / 2) };
		ImageField[] ds = new ImageField[] {
				new ImageField("img/home/1m-1.jpg", screenWidth, screenWidth),
				new ImageField("img/home/2m-1.jpg", screenWidth, screenWidth),
				new ImageField("img/home/3m-1.jpg", screenWidth, screenWidth) };
		ImageField[] es = new ImageField[] {
				new ImageField("img/home/1k-3.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/2k-3.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/3k-3.jpg", screenWidth / 2,
						screenWidth / 2) };
		ImageField[] fs = new ImageField[] {
				new ImageField("img/home/1k-4.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/2k-4.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/3k-4.jpg", screenWidth / 2,
						screenWidth / 2) };
		ImageField[] gs = new ImageField[] {
				new ImageField("img/home/1k-5.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/2k-5.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/3k-5.jpg", screenWidth / 2,
						screenWidth / 2) };
		ImageField[] hs = new ImageField[] {
				new ImageField("img/home/1k-6.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/2k-6.jpg", screenWidth / 2,
						screenWidth / 2),
				new ImageField("img/home/3k-6.jpg", screenWidth / 2,
						screenWidth / 2) };
		ImageField[] is = new ImageField[] {
				new ImageField("img/home/1p-1.jpg", screenWidth / 2,
						screenWidth),
				new ImageField("img/home/2p-1.jpg", screenWidth / 2,
						screenWidth),
				new ImageField("img/home/3p-1.jpg", screenWidth / 2,
						screenWidth) };
		ImageField[] descs = new ImageField[] {
				new ImageField("img/home/1desc.jpg", screenWidth,
						screenWidth / 2),
				new ImageField("img/home/2desc.jpg", screenWidth,
						screenWidth / 2),
				new ImageField("img/home/3desc.jpg", screenWidth,
						screenWidth / 2) };
		a = new Managers(as);
		b = new Managers(bs);
		c = new Managers(cs);
		d = new Managers(ds);
		e = new Managers(es);
		f = new Managers(fs);
		g = new Managers(gs);
		h = new Managers(hs);
		i = new Managers(is);
		j = new Managers(descs);
		HorizontalFieldManager first = new HorizontalFieldManager();
		HorizontalFieldManager second = new HorizontalFieldManager();
		HorizontalFieldManager third = new HorizontalFieldManager();
		HorizontalFieldManager fourth = new HorizontalFieldManager();
		HorizontalFieldManager fifth = new HorizontalFieldManager();
		VerticalFieldManager label = new VerticalFieldManager();
		first.add(a);
		label.add(j);
		second.add(f);
		second.add(c);
		third.add(d);
		fourth.add(i);
		column.add(e);
		column.add(b);
		fourth.add(column);
		fifth.add(g);
		fifth.add(h);
		add(first);
		add(label);
		add(third);
		add(fourth);
		add(fifth);
	}

	private class ImageField extends BitmapField {

		public ImageField(String path, int width, int height) {
			super(View.createImage(path, width, height).getBitmap());
		}

	}

}
